/*
 * bed.h
 *
 *  Created on: Mar 12, 2011
 *      Author: Jason
 */
#include "axis.h"
#include "math.h"



#ifndef BED_H_
#define BED_H_

class cartesian
{
public:
	cartesian();
	//Zeros the X, Y, and Z axis.
	//Velocity x, Velocity Y, Velocity Z, Reverse Velocity
	void zero(double, double, double, double);
	//Configure the system to go to X, Y, Z, and E at velocity V, with a rate of acceleration A
	//update method must be called routinely to update the outputs
	byte go(double, double, double, double, double, double);
	//Configure the system to go to X, Y, Z, and E at velocity V, with a rate of acceleration A
	//function is self updating and does not return until all axis are in position
	void move(double, double, double, double, double, double);
	//Checks and updates each axis for positioning
	//returns 1 if any axis is not yet in position
	//returns 0 if all axis are in position
	byte update(void);
	
	byte busy(void);
	
	void home(double, double);
	
	void setHome(double, double, double);
	
	
	//pointers to axis objects
	axis *_x;  
	axis *_y;
	axis *_z;
	axis *_e;

	double _extRatio;

private:
	double _acc;
	double _vel;
	
	double _xHomeOffset;
	double _yHomeOffset;
	double _zHomeOffset;
	
};

#endif /* BED_H_ */
